﻿using Creator.Core.Entity;
using System.ComponentModel;
using System.Runtime.CompilerServices;

namespace Creator.Core.Entity
{
    /// <summary>
    /// 实现与ui的双向绑定的基类
    /// </summary>
    public abstract class ViewModelBase : INotifyPropertyChanged, IUIEntity
    {
        public abstract int IdHashCode { get; }
        public virtual string Name { get; } = "未重写";
        public virtual string Description { get; } = "未重写";
        public virtual string RealTimeInfo { get; set; } = "未重写";
        public virtual double Width { get; } = 45;
        public virtual double Height { get; } = 45;
        public virtual double PosX { get; } = 0;
        public virtual double PosY { get; } = 0;
 

        public virtual void RaisePropertyChanged([CallerMemberName] string propertyName = null)
        {
            this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
        }
        public event PropertyChangedEventHandler PropertyChanged;
    }
}
